import request from "@/utils/request";
import { AxiosPromise } from "axios";
import {AuditColumnQuery} from "@/api/auditConfig/types";

/**
 * 标准核销单分页数据
 *
 * @param queryParams
 */
export function getAuditColumnPage(
	queryParams: AuditColumnQuery
): AxiosPromise<PageResult<[]>> {
	return request({
		url: '/api/v1/auditColumn/page',
		method: 'get',
		params: queryParams
	});
}

/**
 * 下载标准核销单配置导入模板
 *
 * @returns
 */
export function downloadTemplateApi() {
	return request({
		url: '/api/v1/auditColumn/template',
		method: 'get',
		responseType: 'arraybuffer'
	});
}

/**
 * 导入标准核销单配置
 *
 * @param file
 */
export function importAuditColumn(file: File) {
	const formData = new FormData();
	formData.append('file', file);
	return request({
		url: '/api/v1/auditColumn/_import',
		method: 'post',
		data: formData,
		headers: {
			'Content-Type': 'multipart/form-data'
		}
	});
}

/**
 * 导出核销账单配置
 *
 * @param queryParams
 * @returns
 */
export function exportAuditColumn() {
	return request({
		url: '/api/v1/auditColumn/_export',
		method: 'get',
		responseType: 'arraybuffer'
	});
}
